package test8;


import java.util.LinkedList;
import java.util.Queue;
import java.util.Scanner;

public class test8_3 {
	public static void main(String[] args){
		Queue<Integer> q1=new LinkedList();
		Queue<Integer> q2=new LinkedList();
		Scanner sr=new Scanner(System.in);
		int n=sr.nextInt();
		for(int i=0;i<n;i++){
			int e=sr.nextInt();
			if(e%2!=0){
				q1.offer(e);
			}
			else
				q2.offer(e);
		}
		int i=0;
		if(q1.size()!=0){
			System.out.print(q1.poll());
			i++;
		}
		if(q1.size()!=0){
			System.out.print(" "+q1.poll());
			i++;
		}
		if(q2.size()!=0&&q1.size()==0){
			System.out.print(q2.poll());
			i++;
		}
		if(q2.size()!=0){
			System.out.print(" "+q2.poll());
			i++;
		}
		
		while(i<n){
			if(q1.size()!=0){
				System.out.print(" "+q1.poll());
				i++;
			}
			if(q1.size()!=0){
				System.out.print(" "+q1.poll());
				i++;
			}
			if(q2.size()!=0){
				System.out.print(" "+q2.poll());
				i++;
			}
			
		}
		
	}

	

}


